import 'package:flutter/material.dart';
import 'package:flutter_project/common/route_page/route_name.dart';
import 'package:flutter_project/common/utils/privacy_html_route_utils.dart';
import 'package:flutter_project/common/utils/scan_main_page.dart';
import 'package:flutter_project/help/help_feed.dart';
import 'package:flutter_project/user/account_manage_page.dart';
import 'package:flutter_project/user/user_info/user_edit_info.dart';
import 'package:flutter_project/user/user_login/user_login_phone_view.dart';
import '../config/theme_color.dart';
import '../help/damu_show_page.dart';
import '../home/notice/system_notice_list_page.dart';
import '../picture/create_series_page.dart';
import '../video/video_likes_set_page.dart';
import 'ask_survey/ask_survey_page.dart';

class UserProfilePage extends StatefulWidget {
  const UserProfilePage({super.key});

  @override
  State<UserProfilePage> createState() => _UserProfilePageState();
}

class _UserProfilePageState extends State<UserProfilePage> {
  String accountManageStr = '账号管理';
  String privacyStr = '隐私声明';
  String userAgreeStr = '用户协议';
  Color lineColor = ThemeColor.lineE8e8e8Color;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ThemeColor.mainBgColor,
      body: Column(
        children: [
          GestureDetector(
            onTap: () {
              RouteNames.push(const UserLoginPhoneView());
            },
            child: Container(
              height: 131,
              decoration: BoxDecoration(
                gradient: LinearGradient(
                    colors: [
                      const Color.fromRGBO(179, 158, 237, 0.0),
                      ThemeColor.mainBgColor
                    ],
                    tileMode: TileMode.mirror,
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter),
              ),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  const SizedBox(
                    width: 16,
                  ),
                  GestureDetector(
                    onTap: () {
                      RouteNames.push(UserEditInfo());
                    },
                    child: Image.asset(
                      'assets/images/as_avatar_man.png',
                      width: 60,
                    ),
                  ),
                  const SizedBox(
                    width: 10,
                  ),
                  Column(
                    mainAxisSize: MainAxisSize.min,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      const Text(
                        '点击登录',
                        style: TextStyle(
                            fontSize: 18, fontWeight: FontWeight.bold),
                      ),
                      const SizedBox(
                        height: 10,
                      ),
                      Text(
                        'ID:1960406666',
                        style: TextStyle(color: ThemeColor.textColorSecond),
                      ),
                    ],
                  ),
                  const SizedBox(
                    width: 110,
                  ),
                  GestureDetector(
                    onTap: () {
                      RouteNames.push(const ScanMainPage());
                    },
                    child: Image.asset(
                      'assets/images/scan/main_scan_white.png',
                      width: 20,
                      color: Colors.black,
                    ),
                  ),
                ],
              ),
            ),
          ),
          const SizedBox(
            height: 20,
          ),
          Expanded(
            child: ListView(
              padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
              children: [
                const SizedBox(height: 20),
                Container(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 20, vertical: 0),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(0),
                    //boxShadow: const [UX.boxShadow],
                  ),
                  child: Column(
                    children: [
                      InkWell(
                        onTap: () {
                          jumpPrivacyPage();
                        },
                        child: getListItem(name: privacyStr),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          jumpUserAgreePage();
                        },
                        child: getListItem(name: userAgreeStr),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {},
                        child: getListItem(name: '用户反馈'),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          RouteNames.push(AccountManagePage(
                            title: accountManageStr,
                          ));
                        },
                        child: getListItem(name: accountManageStr),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          RouteNames.push(const CreateSeriesPage());
                        },
                        child: getListItem(name: '上传视频'),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          RouteNames.push(const VideoLikesSetPage());
                        },
                        child: getListItem(name: '看剧偏好'),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          RouteNames.push(const SystemNoticeListPage());
                        },
                        child: getListItem(name: '系统通知'),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          RouteNames.push(const AskSurveyPage());
                        },
                        child: getListItem(name: '问卷调查'),
                      ),
                      Divider(
                        height: 1,
                        color: lineColor,
                      ),
                      InkWell(
                        onTap: () {
                          RouteNames.push( DanmuScreen());
                        },
                        child: getListItem(name: '帮助反馈'),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }

  Widget getListItem({
    required String name,
  }) {
    return Row(
      children: [
        Padding(
          padding: const EdgeInsets.symmetric(vertical: 16),
          child: Text(
            name,
          ),
        ),
        const Spacer(),
        Icon(
          Icons.arrow_forward_ios_rounded,
          size: 14,
          color: ThemeColor.grayB5B5B5Color,
        ),
      ],
    );
  }
}
